<html>
<head><meta charset="utf-8"><title>read/write_unaligned with ZST · t-lang/wg-unsafe-code-guidelines · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/index.html">t-lang/wg-unsafe-code-guidelines</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/read.2Fwrite_unaligned.20with.20ZST.html">read/write_unaligned with ZST</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="152649647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/read/write_unaligned%20with%20ZST/near/152649647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> kennytm <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/read.2Fwrite_unaligned.20with.20ZST.html#152649647">(Dec 28 2018 at 11:35)</a>:</h4>
<p>In &lt;<a href="https://doc.rust-lang.org/nightly/std/ptr/fn.read_unaligned.html" target="_blank" title="https://doc.rust-lang.org/nightly/std/ptr/fn.read_unaligned.html">https://doc.rust-lang.org/nightly/std/ptr/fn.read_unaligned.html</a>&gt; and &lt;<a href="https://doc.rust-lang.org/nightly/std/ptr/fn.write_unaligned.html" target="_blank" title="https://doc.rust-lang.org/nightly/std/ptr/fn.write_unaligned.html">https://doc.rust-lang.org/nightly/std/ptr/fn.write_unaligned.html</a>&gt;, the Safety section mentioned that</p>
<blockquote>
<p>Note that even if T has size 0, the pointer must be non-NULL and <strong>properly aligned</strong>.</p>
</blockquote>
<p>Is this just a copy-paste error, or a special restriction for ZSTs?</p>



<a name="152649707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/read/write_unaligned%20with%20ZST/near/152649707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nicole Mazzuca <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/read.2Fwrite_unaligned.20with.20ZST.html#152649707">(Dec 28 2018 at 11:36)</a>:</h4>
<p>copy paste error</p>



<a name="152649725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/read/write_unaligned%20with%20ZST/near/152649725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> kennytm <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/read.2Fwrite_unaligned.20with.20ZST.html#152649725">(Dec 28 2018 at 11:37)</a>:</h4>
<p>thanks :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>